package com.shy.wonderfuleffect.tool

import android.content.Context
import android.util.Log
import android.util.TypedValue

class CommonTools {
    companion object {
        @JvmStatic
        fun String.loggingI(tag: String) {
            Log.i(tag, this)
        }

        @JvmStatic
        fun String.loggingV(tag: String) {
            Log.v(tag, this)
        }

        @JvmStatic
        fun String.loggingD(tag: String) {
            Log.d(tag, this)
        }

        @JvmStatic
        fun String.loggingE(tag: String) {
            Log.e(tag, this)
        }

        fun Int.dp(context: Context): Float {
            return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                this.toFloat(),
                context.resources.displayMetrics)
        }

        fun Float.dp(context: Context): Float {
            return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                this,
                context.resources.displayMetrics)
        }
    }
}